package com.victor.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.victor.dao.HistoryDao;
import com.victor.dao.PictureStaticDao;
import com.victor.entity.History;
import com.victor.service.HistoryService;

@Service
public class HistoryServiceImpl implements HistoryService {

	@Autowired
	private HistoryDao dao;

	@Autowired
	private PictureStaticDao staticDao;

	@Override
	public boolean batchDelete(int[] ids) {
		if (staticDao.updateYD(ids) < 0) {
			return false;
		}
		return dao.batchDelete(ids) > 0 ? true : false;
	}

	@Override
	public boolean insert(History record) {
		return dao.insert(record) > 0 ? true : false;
	}

	@Override
	public History findById(Integer hId) {
		return dao.findById(hId);
	}

	@Override
	public boolean update(History record) {
		return dao.update(record) > 0 ? true : false;
	}

	@Override
	public List<Map<String, String>> getHistorym(String uid, String pictype) {
		return dao.getHistorym(uid, pictype);
	}

	@Override
	public History findByPicId(String hPicId, String hUserId) {
		return dao.findByPicId(hPicId, hUserId);
	}

	@Override
	public boolean updatePicId(History history) {
		return dao.updatePicId(history) > 0 ? true : false;
	}

}
